﻿//*** Guidance generated code ***//
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using System.Xml.Linq;

using ProjectBase.Core;
using ProjectBase.Core.Web;

namespace $safeprojectname$.Models
{
    /// <summary>
    ///     Collects all needed information for exporting data 
    ///     to the client in the specified format (xml, Excel sheet ...)
    /// </summary>
    public class ExportModel : CoreModel, IExportModel
    {
        #region members
        Encoding _encoding = Encoding.Unicode;
        #endregion members

        #region IExportModel Members
        /// <summary>
        ///     Linq Data source, which will be by bytes sent to the client
        /// </summary>
        public virtual XDocument XDocument { get; set; }

        /// <summary>
        ///     The file itself in binnary (this property is used if XDocument.IsNull())
        /// </summary>
        public virtual IEnumerable<byte> DataOutput { get; set; }

        /// <summary>
        ///     In some cases could be handy to create the output stream from the IDataReader
        /// </summary>
        public virtual IDataReader DataReader { get; set; }

        public virtual string ColumnSeparator { get; set; }

        /// <summary>
        ///     Response MIME content type, informing the browser how to handle the result
        /// </summary>
        public virtual string ContentType { get; set; }

        /// <summary>
        ///     The file name for exported data. 
        ///     Browser usually will use this name as suggested file-name.
        /// </summary>
        public virtual string FileName { get; set; }

        /// <summary>
        ///     The extension suggested on browser e.g. ".xls", ".doc", ".xml"
        /// </summary>
        public virtual string FileExtension { get; set; }

        /// <summary>
        ///     Encoding for exported file
        /// </summary>
        public virtual Encoding Encoding
        {
            get { return _encoding; }
            set { _encoding = value; }
        }
        #endregion
    }
}